﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Models;
namespace AGVControlSystemPro
{
    /// <summary>
    /// 公共实体全局变量类
    /// </summary>
    public static class CommonMethods
    {
        //当前呼叫信息数据集合
        public static List<ExCall> ListPreCall = new List<ExCall>();
        //呼叫信息是否显示标志位 false:不更新 true:更新
        public static bool StatndbyCallDisplayFlag = false;
        //当前交管信息集合
        public static List<TrafficInfo> ListPreTraffic = new List<TrafficInfo>();
        //交管显示标志位
        public static bool isDisplyTraffic = false;
        public static int LanguageId = 0;
        //本地IP
        public static string ServerLocalIP = string.Empty;
        /// <summary>
        /// 获取当前语言
        /// </summary>
        public static void GetLanguage()
        {
            string filePath = System.Windows.Forms.Application.StartupPath + @"\ProjectConfig.ini";//配置文件路径
            string language = new Common.INIFileHelper(filePath).IniReadValue("工程文件", "语言");
            string languageId= new Common.INIFileHelper(filePath).IniReadValue("工程文件", "语言ID");
            if (languageId != string.Empty)
            {
                LanguageId = Convert.ToInt32(languageId);
                System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(language);
            }
            else
            {
                LanguageId = 1;
                new Common.INIFileHelper(filePath).IniWriteValue("工程文件", "语言", "zh-CN");
                new Common.INIFileHelper(filePath).IniWriteValue("工程文件", "语言ID", "1");
            }
        }
    }
}
